snapshot: Avoid a double-free
authorTimm Bäder <mail@baedert.org>
Tue, 14 Feb 2017 12:23:08 +0000 (13:23 +0100)
committerTimm Bäder <mail@baedert.org>
Tue, 14 Feb 2017 15:56:55 +0000 (16:56 +0100)
We can't pass the same string to two different snapshot states since
removing one of them will free the passed string, so just create another
one for the second state.

gtk/gtksnapshot.c

index 7b8bfddf68aa7654c8eb839b38210beba6072dc8..77146e4baff61c00b35526f7b41d563172238934 100644 (file)
@@ -742,7 +742,7 @@ gtk_snapshot_push_blend (GtkSnapshot  *snapshot,
   state->data.blend.bottom_node = NULL;
 
   state = gtk_snapshot_state_new (state,
-                                  str,
+                                  g_strdup (str),
                                   state->clip_region,
                                   state->translate_x,
                                   state->translate_y,
@@ -863,7 +863,7 @@ gtk_snapshot_push_cross_fade (GtkSnapshot *snapshot,
   state->data.cross_fade.start_node = NULL;
 
   state = gtk_snapshot_state_new (state,
-                                  str,
+                                  g_strdup (str),
                                   state->clip_region,
                                   state->translate_x,
                                   state->translate_y,